<template>
  <view class="content">
    <uni-nav-bar
      title="兑换记录"
      color="#fff"
      backgroundColor="transparent"
      :border="false"
      :statusBar="true"
      :fixed="true"
      @clickLeft="$c.back()"
    >
      <view class="uni-nav-bar-l-icon" slot="left">
        <view class="uni-nav-bar-l-icon-left icon">
          <image :src="$img('/static/img2/cc20.png')" lazy-load></image>
        </view>
      </view>
    </uni-nav-bar>

    <!-- <view class="tab-list">
      <view
        @click="getlist(i + 1)"
        v-for="(item, i) in arr"
        :key="i"
        class="tab-list-item"
        :class="{
          active: show == i + 1
        }"
      >
        {{ item }}

        <image
          v-if="show == i + 1"
          class="arrow"
          :src="$img('/static/img/tab_arrow.png')"
          mode="scaleToFill"
        />
      </view>
    </view> -->

    <!-- <view class="head">
      <view
        class="status_bar"
        :style="'height:' + statusBarHeight + 'px;'"
      ></view>
      <view class="header_title">
        <view @click="back()">
          返回
        </view>
        <view class="hang1">打包记录</view>
      </view>
    </view> -->
    <!-- 内容 -->
    <mescroll-body
      ref="mescrollRef"
      @init="mescrollInit"
      :down="downOption"
      @down="downCallback"
      @up="upCallback"
    >
      <view class="xuyuan" v-for="(v, i) in listData" :key="i">
        <view class="xuyuan_head">
          <view style="opacity: 1">兑换时间:{{ v.addtime }}</view>
          <view style="font-size: 28rpx">
            共
            <text style="color: #e40d88; margin: 0 4rpx">{{ v.count }}</text>
            件
          </view>
        </view>
        <view class="xuyuan_con">
          <view class="xuyuan_item" v-for="(a, b) in v.order_list" :key="b">
            <view class="list_img">
              <image :src="a.goodslist_imgurl"></image>
              <view class="shang_title">
                <!-- <view class="type">
                  {{ a.shang_title }}
                </view> -->

                <view class="num">{{ a.prize_num }}件</view>
              </view>
              <!-- <view class="allNum">X{{a.prize_num}}</view> -->
            </view>
            <view class="xuyuan_item_2 flex_center hang1">
              <view class="hang1">{{ a.goodslist_title }}</view>
            </view>

            <view class="tui-money">兑换价:{{ a.goodslist_money }}</view>
          </view>
        </view>
        <!-- <view class="xuyuan_con">
          <view class="xuyuan_item" v-for="(a, b) in v.order_list" :key="b">
            <view class="list_img">
              <image :src="a.goodslist_imgurl"></image>
              <view class="shang_title">
                {{ a.shang_title }} X{{ a.prize_num }}
              </view>
            </view>
            <view class="xuyuan_item_2 flex_center">
              <view class="hang1">{{ a.goodslist_title }}</view>
            </view>
          </view>
        </view> -->
        <view class="xuyuan_foot">
          <view>
            共计兑换:
            <text style="font-size: 28rpx; color: #E40D1D">{{ v.money }}</text>
          </view>
        </view>
      </view>
    </mescroll-body>
  </view>
</template>

<script>
export default {
  data() {
    return {
      z_imgPath: this.$z_img2 + 'mine/',
      statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
      downOption: {
        auto: false
      },
      listData: []
    }
  },
  onLoad(e) {},
  methods: {
    back() {
      uni.navigateBack()
    },
    /*下拉刷新的回调 */
    downCallback() {
      this.mescroll.resetUpScroll()
    },
    /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
    upCallback(page) {
      //联网加载数据
      this.loadData(page.num)
    },
    loadData(pageNo) {
      // 模拟接口
      let that = this
      that.req({
        url: 'warehouse_recovery_record',
        Loading: true,
        data: {
          page: pageNo
        },
        success(res) {
          that.mescroll.endByPage(res.data.data.length, res.data.last_page)
          if (pageNo == 1) {
            that.listData = res.data.data
          } else {
            that.listData = that.listData.concat(res.data.data)
          }
        }
      })
    }
  }
}
</script>

<style lang="scss">
.xuyuan_foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 30rpx;

  font-family: PingFang SC, PingFang SC;
  font-weight: 400;
  font-size: 28rpx;
  color: #ffffff;
}

.xuyuan_item_2 {
  color: #ffffff;
  font-size: 24rpx;
  width: 100%;
  margin-top: 4rpx;
  // padding: 0 10rpx;
}

.tui-money {
  font-family: PingFang SC, PingFang SC;
  font-weight: 400;
  font-size: 24rpx;
  color: #e40d1d;
}

.allNum {
  position: absolute;
  bottom: 0rpx;
  right: 0rpx;
  font-size: 22rpx;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 8rpx 0 0 8rpx;
  color: #fff;
  padding: 5rpx 10rpx;
}

.list_img .shang_title {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 32rpx;
  background: rgba(0, 0, 0, 0.8);
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;

  .type {
    height: 100%;
    padding: 0 16rpx;
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, #6adeff 0%, #7ab5ff 50%, #ff7feb 100%);

    font-size: 20rpx;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #222222;
  }

  .num {
    padding-right: 10rpx;

    font-size: 24rpx;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #ffffff;
  }
}

.list_img > image {
  width: 100%;
  height: 100%;
}

.list_img {
  width: 100%;
  height: 170rpx;
  position: relative;
  box-sizing: border-box;
  border: 2rpx solid #000000;
  position: relative;
}

.xuyuan_item {
  width: 170rpx;
  box-sizing: border-box;
  margin-right: 20rpx;

  &:last-child {
    margin-right: 0;
  }
}

.xuyuan_con {
  display: flex;
  margin: 14rpx auto 0;
  width: 630rpx;
  box-sizing: border-box;
  border-bottom: 1rpx solid #333;
  padding-bottom: 20rpx;
  overflow-x: scroll;
}

.xuyuan_head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10rpx 24rpx;
  box-sizing: border-box;

  font-family: PingFang SC, PingFang SC;
  font-weight: 400;
  font-size: 22rpx;
  color: #ffffff;
}

.xuyuan {
  width: 690rpx;
  /* height: 414rpx; */
  margin: 20rpx auto;
  // box-shadow: 0px -2rpx 7rpx 0px #1FF7F0;
  padding-top: 10rpx;
  background: #252525;
  border: 2rpx solid #444444;
}

.content {
  width: 100vw;
  min-height: 100vh;
  box-sizing: border-box;
  color: #fff;
  .head {
    position: fixed;
    top: 0;
    z-index: 20;

    .header_title {
      height: 70rpx;
      line-height: 70rpx;
      width: 100%;
      box-sizing: border-box;
      font-weight: bold;
      display: flex;
      align-items: center;
      padding-left: 30rpx;
      box-sizing: border-box;

      > view:nth-of-type(1) {
        display: flex;
        align-items: center;
      }

      > view:nth-of-type(2) {
        width: 520rpx;
        text-align: center;
        /* margin: auto; */
      }

      image {
        width: 48rpx;
        height: 48rpx;
      }
    }
  }
}

.tab-list {
  display: flex;
  padding: 30rpx;

  .tab-list-item {
    margin-right: 40rpx;
    position: relative;

    font-size: 30rpx;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #ffffff;

    .arrow {
      position: absolute;
      left: 50%;
      bottom: -28rpx;
      transform: translateX(-50%);
      width: 40rpx;
      height: 20rpx;
    }

    &.active {
      text-shadow: 0 0 10rpx #ba39ff;
    }
  }
}
</style>
